

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>Librbd 的 Python 接口 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="Ceph 对象网关" href="../../../radosgw/" />
    <link rel="prev" title="Ceph 块设备 API" href="../" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../../">Ceph 块设备</a> &raquo;</li>
        
          <li><a href="../">Ceph 块设备 API</a> &raquo;</li>
        
      <li>Librbd 的 Python 接口</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../../_sources/rbd/api/librbdpy.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../">
          

          
            
            <img src="../../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Ceph 块设备</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../rados-rbd-cmds/">基本命令</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../rbd-operations/">运维</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../rbd-integrations/">对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../man/">手册页</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../">APIs</a><ul class="current">
<li class="toctree-l3 current"><a class="current reference internal" href="#">librbd (Python)</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id1">实例：创建一映像并写入</a></li>
<li class="toctree-l4"><a class="reference internal" href="#api">API 参考</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="librbd-python">
<span id="rbd-api-py"></span><h1>Librbd 的 Python 接口<a class="headerlink" href="#librbd-python" title="Permalink to this headline">¶</a></h1>
<p><cite>rbd</cite> 的 python 模块为 RBD 映像提供了类似文件的访问方法。</p>
<div class="section" id="id1">
<h2>实例：创建一映像并写入<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<p>要使用 <cite>rbd</cite> ，必须先连接 RADOS 并打开 IO 上下文：</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">cluster</span> <span class="o">=</span> <span class="n">rados</span><span class="o">.</span><span class="n">Rados</span><span class="p">(</span><span class="n">conffile</span><span class="o">=</span><span class="s1">&#39;my_ceph.conf&#39;</span><span class="p">)</span>
<span class="n">cluster</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
<span class="n">ioctx</span> <span class="o">=</span> <span class="n">cluster</span><span class="o">.</span><span class="n">open_ioctx</span><span class="p">(</span><span class="s1">&#39;mypool&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>然后实例化 :class:rbd.RBD 对象，用它来创建映像：</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">rbd_inst</span> <span class="o">=</span> <span class="n">rbd</span><span class="o">.</span><span class="n">RBD</span><span class="p">()</span>
<span class="n">size</span> <span class="o">=</span> <span class="mi">4</span> <span class="o">*</span> <span class="mi">1024</span><span class="o">**</span><span class="mi">3</span>  <span class="c1"># 4 GiB</span>
<span class="n">rbd_inst</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">ioctx</span><span class="p">,</span> <span class="s1">&#39;myimage&#39;</span><span class="p">,</span> <span class="n">size</span><span class="p">)</span>
</pre></div>
</div>
<p>要在映像上进行 I/O 操作，需实例化 :class:rbd.Image 对象：</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">image</span> <span class="o">=</span> <span class="n">rbd</span><span class="o">.</span><span class="n">Image</span><span class="p">(</span><span class="n">ioctx</span><span class="p">,</span> <span class="s1">&#39;myimage&#39;</span><span class="p">)</span>
<span class="n">data</span> <span class="o">=</span> <span class="sa">b</span><span class="s1">&#39;foo&#39;</span> <span class="o">*</span> <span class="mi">200</span>
<span class="n">image</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
</pre></div>
</div>
<p>上面的代码向映像前面写入了 600 字节的 foo 字符串。
注意数据不能是 :type:unicode - <cite>Librbd</cite> 不能处理大于 :c:type:char 的字符串。</p>
<p>最后，关闭映像、 IO 上下文、和到 RADOS 的连接。</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">image</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="n">ioctx</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="n">cluster</span><span class="o">.</span><span class="n">shutdown</span><span class="p">()</span>
</pre></div>
</div>
<p>安全起见，每个调用都应该封装到单独的 :finally 块内。</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">cluster</span> <span class="o">=</span> <span class="n">rados</span><span class="o">.</span><span class="n">Rados</span><span class="p">(</span><span class="n">conffile</span><span class="o">=</span><span class="s1">&#39;my_ceph_conf&#39;</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
    <span class="n">cluster</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
    <span class="n">ioctx</span> <span class="o">=</span> <span class="n">cluster</span><span class="o">.</span><span class="n">open_ioctx</span><span class="p">(</span><span class="s1">&#39;my_pool&#39;</span><span class="p">)</span>
    <span class="k">try</span><span class="p">:</span>
        <span class="n">rbd_inst</span> <span class="o">=</span> <span class="n">rbd</span><span class="o">.</span><span class="n">RBD</span><span class="p">()</span>
        <span class="n">size</span> <span class="o">=</span> <span class="mi">4</span> <span class="o">*</span> <span class="mi">1024</span><span class="o">**</span><span class="mi">3</span>  <span class="c1"># 4 GiB</span>
        <span class="n">rbd_inst</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">ioctx</span><span class="p">,</span> <span class="s1">&#39;myimage&#39;</span><span class="p">,</span> <span class="n">size</span><span class="p">)</span>
        <span class="n">image</span> <span class="o">=</span> <span class="n">rbd</span><span class="o">.</span><span class="n">Image</span><span class="p">(</span><span class="n">ioctx</span><span class="p">,</span> <span class="s1">&#39;myimage&#39;</span><span class="p">)</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="n">data</span> <span class="o">=</span> <span class="sa">b</span><span class="s1">&#39;foo&#39;</span> <span class="o">*</span> <span class="mi">200</span>
            <span class="n">image</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
        <span class="k">finally</span><span class="p">:</span>
            <span class="n">image</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
    <span class="k">finally</span><span class="p">:</span>
        <span class="n">ioctx</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">finally</span><span class="p">:</span>
    <span class="n">cluster</span><span class="o">.</span><span class="n">shutdown</span><span class="p">()</span>
</pre></div>
</div>
<p>这样做有些繁琐，所以 <code class="xref py py-class docutils literal notranslate"><span class="pre">Rados</span></code> 、 <code class="xref py py-class docutils literal notranslate"><span class="pre">Ioctx</span></code> 和
<code class="xref py py-class docutils literal notranslate"><span class="pre">Image</span></code> 类可以当上下文管理器来用，
它能自动关闭（见 <span class="target" id="index-0"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0343"><strong>PEP 343</strong></a> ）。当上下文管理器用时，
上面的实例可以写成：</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">with</span> <span class="n">rados</span><span class="o">.</span><span class="n">Rados</span><span class="p">(</span><span class="n">conffile</span><span class="o">=</span><span class="s1">&#39;my_ceph.conf&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">cluster</span><span class="p">:</span>
    <span class="k">with</span> <span class="n">cluster</span><span class="o">.</span><span class="n">open_ioctx</span><span class="p">(</span><span class="s1">&#39;mypool&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">ioctx</span><span class="p">:</span>
        <span class="n">rbd_inst</span> <span class="o">=</span> <span class="n">rbd</span><span class="o">.</span><span class="n">RBD</span><span class="p">()</span>
        <span class="n">size</span> <span class="o">=</span> <span class="mi">4</span> <span class="o">*</span> <span class="mi">1024</span><span class="o">**</span><span class="mi">3</span>  <span class="c1"># 4 GiB</span>
        <span class="n">rbd_inst</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">ioctx</span><span class="p">,</span> <span class="s1">&#39;myimage&#39;</span><span class="p">,</span> <span class="n">size</span><span class="p">)</span>
        <span class="k">with</span> <span class="n">rbd</span><span class="o">.</span><span class="n">Image</span><span class="p">(</span><span class="n">ioctx</span><span class="p">,</span> <span class="s1">&#39;myimage&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">image</span><span class="p">:</span>
            <span class="n">data</span> <span class="o">=</span> <span class="sa">b</span><span class="s1">&#39;foo&#39;</span> <span class="o">*</span> <span class="mi">200</span>
            <span class="n">image</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="api">
<h2>API 参考<a class="headerlink" href="#api" title="Permalink to this headline">¶</a></h2>
<span class="target" id="module-rbd"></span><p>This module is a thin wrapper around librbd.</p>
<p>It currently provides all the synchronous methods of librbd that do
not use callbacks.</p>
<p>Error codes from librbd are turned into exceptions that subclass
<code class="xref py py-class docutils literal notranslate"><span class="pre">Error</span></code>. Almost all methods may raise <code class="xref py py-class docutils literal notranslate"><span class="pre">Error</span></code>
(the base class of all rbd exceptions), <code class="xref py py-class docutils literal notranslate"><span class="pre">PermissionError</span></code>
and <code class="xref py py-class docutils literal notranslate"><span class="pre">IOError</span></code>, in addition to those documented for the
method.</p>
<dl class="py class">
<dt id="rbd.Image">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">rbd.</span></code><code class="sig-name descname"><span class="pre">Image</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">snapshot</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">read_only</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image_id</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_oncomplete</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.Image" title="Permalink to this definition">¶</a></dt>
<dd><p>This class represents an RBD image. It is used to perform I/O on
the image and interact with snapshots.</p>
<p><strong>Note</strong>: Any method of this class may raise <code class="xref py py-class docutils literal notranslate"><span class="pre">ImageNotFound</span></code>
if the image has been deleted.</p>
<dl class="py method">
<dt id="rbd.Image.close">
<code class="sig-name descname"><span class="pre">close</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.Image.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Release the resources used by this image object.</p>
<p>After this is called, this object should not be used.</p>
</dd></dl>

<dl class="py method">
<dt id="rbd.Image.require_not_closed">
<code class="sig-name descname"><span class="pre">require_not_closed</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.Image.require_not_closed" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if the Image is not closed</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidArgument</span></code></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="rbd.RBD">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">rbd.</span></code><code class="sig-name descname"><span class="pre">RBD</span></code><a class="headerlink" href="#rbd.RBD" title="Permalink to this definition">¶</a></dt>
<dd><p>This class wraps librbd CRUD functions.</p>
<dl class="py method">
<dt id="rbd.RBD.aio_open_image">
<code class="sig-name descname"><span class="pre">aio_open_image</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">oncomplete</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">snapshot</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">read_only</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image_id</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.aio_open_image" title="Permalink to this definition">¶</a></dt>
<dd><p>Asynchronously open the image at the given snapshot.
Specify either name or id, otherwise <code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidArgument</span></code> is raised.</p>
<p>oncomplete will be called with the created Image object as
well as the completion:</p>
<p>oncomplete(completion, image)</p>
<p>If a snapshot is specified, the image will be read-only, unless
<code class="xref py py-func docutils literal notranslate"><span class="pre">Image.set_snap()</span></code> is called later.</p>
<p>If read-only mode is used, metadata for the <a class="reference internal" href="#rbd.Image" title="rbd.Image"><code class="xref py py-class docutils literal notranslate"><span class="pre">Image</span></code></a>
object (such as which snapshots exist) may become obsolete. See
the C api for more details.</p>
<p>To clean up from opening the image, <a class="reference internal" href="#rbd.Image.close" title="rbd.Image.close"><code class="xref py py-func docutils literal notranslate"><span class="pre">Image.close()</span></code></a> or
<code class="xref py py-func docutils literal notranslate"><span class="pre">Image.aio_close()</span></code> should be called.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>oncomplete</strong> (<em>completion</em>) – what to do when open is complete</p></li>
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>name</strong> (<em>str</em>) – the name of the image</p></li>
<li><p><strong>snapshot</strong> – which snapshot to read from</p></li>
<li><p><strong>read_only</strong> (<em>bool</em>) – whether to open the image in read-only mode</p></li>
<li><p><strong>image_id</strong> (<em>str</em>) – the id of the image</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Completion</span></code> - the completion object</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.clone">
<code class="sig-name descname"><span class="pre">clone</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p_ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p_snapname</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">c_ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">c_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">features</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">order</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stripe_unit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stripe_count</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_pool</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.clone" title="Permalink to this definition">¶</a></dt>
<dd><p>Clone a parent rbd snapshot into a COW sparse child.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>p_ioctx</strong> – the parent context that represents the parent snap</p></li>
<li><p><strong>p_name</strong> – the parent image name</p></li>
<li><p><strong>p_snapname</strong> – the parent image snapshot name</p></li>
<li><p><strong>c_ioctx</strong> – the child context that represents the new clone</p></li>
<li><p><strong>c_name</strong> – the clone (child) name</p></li>
<li><p><strong>features</strong> (<em>int</em>) – bitmask of features to enable; if set, must include layering</p></li>
<li><p><strong>order</strong> (<em>int</em>) – the image is split into (2**order) byte objects</p></li>
<li><p><strong>stripe_unit</strong> (<em>int</em>) – stripe unit in bytes (default None to let librbd decide)</p></li>
<li><p><strong>stripe_count</strong> (<em>int</em>) – objects to stripe over before looping</p></li>
<li><p><strong>data_pool</strong> (<em>str</em>) – optional separate pool for data blocks</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">TypeError</span></code></p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidArgument</span></code></p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageExists</span></code></p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">FunctionNotSupported</span></code></p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ArgumentOutOfRange</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.config_get">
<code class="sig-name descname"><span class="pre">config_get</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.config_get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a pool-level configuration override.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p></li>
<li><p><strong>key</strong> (<em>str</em>) – key</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>str - value</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.config_list">
<code class="sig-name descname"><span class="pre">config_list</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.config_list" title="Permalink to this definition">¶</a></dt>
<dd><p>List pool-level config overrides.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ConfigPoolIterator</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.config_remove">
<code class="sig-name descname"><span class="pre">config_remove</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.config_remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove a pool-level configuration override.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p></li>
<li><p><strong>key</strong> (<em>str</em>) – key</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>str - value</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.config_set">
<code class="sig-name descname"><span class="pre">config_set</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.config_set" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a pool-level configuration override.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p></li>
<li><p><strong>key</strong> (<em>str</em>) – key</p></li>
<li><p><strong>value</strong> (<em>str</em>) – value</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.create">
<code class="sig-name descname"><span class="pre">create</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">size</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">order</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">old_format</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">features</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stripe_unit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stripe_count</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_pool</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.create" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an rbd image.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – the context in which to create the image</p></li>
<li><p><strong>name</strong> (<em>str</em>) – what the image is called</p></li>
<li><p><strong>size</strong> (<em>int</em>) – how big the image is in bytes</p></li>
<li><p><strong>order</strong> (<em>int</em>) – the image is split into (2**order) byte objects</p></li>
<li><p><strong>old_format</strong> (<em>bool</em>) – whether to create an old-style image that
is accessible by old clients, but can’t
use more advanced features like layering.</p></li>
<li><p><strong>features</strong> (<em>int</em>) – bitmask of features to enable</p></li>
<li><p><strong>stripe_unit</strong> (<em>int</em>) – stripe unit in bytes (default None to let librbd decide)</p></li>
<li><p><strong>stripe_count</strong> (<em>int</em>) – objects to stripe over before looping</p></li>
<li><p><strong>data_pool</strong> (<em>str</em>) – optional separate pool for data blocks</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageExists</span></code></p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">TypeError</span></code></p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidArgument</span></code></p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">FunctionNotSupported</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.features_from_string">
<code class="sig-name descname"><span class="pre">features_from_string</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">str_features</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.features_from_string" title="Permalink to this definition">¶</a></dt>
<dd><p>Get features bitmask from str, if str_features is empty, it will return
RBD_FEATURES_DEFAULT.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>str_features</strong> (<em>str</em>) – feature str</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>int - the features bitmask of the image</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidArgument</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.features_to_string">
<code class="sig-name descname"><span class="pre">features_to_string</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">features</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.features_to_string" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert features bitmask to str.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>features</strong> (<em>int</em>) – feature bitmask</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>str - the features str of the image</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidArgument</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.group_create">
<code class="sig-name descname"><span class="pre">group_create</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.group_create" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a group.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is used</p></li>
<li><p><strong>name</strong> (<em>str</em>) – the name of the group</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ObjectExists</span></code></p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidArgument</span></code></p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">FunctionNotSupported</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.group_list">
<code class="sig-name descname"><span class="pre">group_list</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.group_list" title="Permalink to this definition">¶</a></dt>
<dd><p>List groups.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>list – a list of groups names</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">FunctionNotSupported</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.group_remove">
<code class="sig-name descname"><span class="pre">group_remove</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.group_remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete an RBD group. This may take a long time, since it does
not return until every image in the group has been removed
from the group.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the group is in</p></li>
<li><p><strong>name</strong> (<em>str</em>) – the name of the group to remove</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ObjectNotFound</span></code></p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidArgument</span></code></p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">FunctionNotSupported</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.group_rename">
<code class="sig-name descname"><span class="pre">group_rename</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">src</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.group_rename" title="Permalink to this definition">¶</a></dt>
<dd><p>Rename an RBD group.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the group is in</p></li>
<li><p><strong>src</strong> (<em>str</em>) – the current name of the group</p></li>
<li><p><strong>dest</strong> (<em>str</em>) – the new name of the group</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ObjectExists</span></code></p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ObjectNotFound</span></code></p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidArgument</span></code></p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">FunctionNotSupported</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.list">
<code class="sig-name descname"><span class="pre">list</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.list" title="Permalink to this definition">¶</a></dt>
<dd><p>List image names.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>list – a list of image names</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.list2">
<code class="sig-name descname"><span class="pre">list2</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.list2" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterate over the images in the pool.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageIterator</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.migration_abort">
<code class="sig-name descname"><span class="pre">migration_abort</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">on_progress</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.migration_abort" title="Permalink to this definition">¶</a></dt>
<dd><p>Cancel a previously started but interrupted migration.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>image_name</strong> (<em>str</em>) – the name of the image</p></li>
<li><p><strong>on_progress</strong> (<em>callback function</em>) – optional progress callback function</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageNotFound</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.migration_commit">
<code class="sig-name descname"><span class="pre">migration_commit</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">on_progress</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.migration_commit" title="Permalink to this definition">¶</a></dt>
<dd><p>Commit an executed RBD image migration.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>image_name</strong> (<em>str</em>) – the name of the image</p></li>
<li><p><strong>on_progress</strong> (<em>callback function</em>) – optional progress callback function</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageNotFound</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.migration_execute">
<code class="sig-name descname"><span class="pre">migration_execute</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">on_progress</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.migration_execute" title="Permalink to this definition">¶</a></dt>
<dd><p>Execute a prepared RBD image migration.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>image_name</strong> (<em>str</em>) – the name of the image</p></li>
<li><p><strong>on_progress</strong> (<em>callback function</em>) – optional progress callback function</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageNotFound</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.migration_prepare">
<code class="sig-name descname"><span class="pre">migration_prepare</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest_ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest_image_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">features</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">order</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stripe_unit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stripe_count</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_pool</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.migration_prepare" title="Permalink to this definition">¶</a></dt>
<dd><p>Prepare an RBD image migration.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>image_name</strong> – the current name of the image</p></li>
<li><p><strong>dest_ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which pool to migration into</p></li>
<li><p><strong>dest_image_name</strong> (<em>str</em>) – the name of the destination image (may be the same image)</p></li>
<li><p><strong>features</strong> (<em>int</em>) – bitmask of features to enable; if set, must include layering</p></li>
<li><p><strong>order</strong> (<em>int</em>) – the image is split into (2**order) byte objects</p></li>
<li><p><strong>stripe_unit</strong> (<em>int</em>) – stripe unit in bytes (default None to let librbd decide)</p></li>
<li><p><strong>stripe_count</strong> (<em>int</em>) – objects to stripe over before looping</p></li>
<li><p><strong>data_pool</strong> (<em>str</em>) – optional separate pool for data blocks</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">TypeError</span></code></p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidArgument</span></code></p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageExists</span></code></p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">FunctionNotSupported</span></code></p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ArgumentOutOfRange</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.migration_prepare_import">
<code class="sig-name descname"><span class="pre">migration_prepare_import</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">source_spec</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest_ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest_image_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">features</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">order</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stripe_unit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stripe_count</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_pool</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.migration_prepare_import" title="Permalink to this definition">¶</a></dt>
<dd><p>Prepare an RBD image migration.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>source_spec</strong> (<em>str</em>) – JSON-encoded source-spec</p></li>
<li><p><strong>dest_ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which pool to migration into</p></li>
<li><p><strong>dest_image_name</strong> (<em>str</em>) – the name of the destination image (may be the same image)</p></li>
<li><p><strong>features</strong> (<em>int</em>) – bitmask of features to enable; if set, must include layering</p></li>
<li><p><strong>order</strong> (<em>int</em>) – the image is split into (2**order) byte objects</p></li>
<li><p><strong>stripe_unit</strong> (<em>int</em>) – stripe unit in bytes (default None to let librbd decide)</p></li>
<li><p><strong>stripe_count</strong> (<em>int</em>) – objects to stripe over before looping</p></li>
<li><p><strong>data_pool</strong> (<em>str</em>) – optional separate pool for data blocks</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">TypeError</span></code></p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidArgument</span></code></p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageExists</span></code></p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">FunctionNotSupported</span></code></p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ArgumentOutOfRange</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.migration_status">
<code class="sig-name descname"><span class="pre">migration_status</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image_name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.migration_status" title="Permalink to this definition">¶</a></dt>
<dd><p>Return RBD image migration status.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>image_name</strong> (<em>str</em>) – the name of the image</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>dict - contains the following keys:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">source_pool_id</span></code> (int) - source image pool id</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">source_pool_namespace</span></code> (str) - source image pool namespace</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">source_image_name</span></code> (str) - source image name</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">source_image_id</span></code> (str) - source image id</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">dest_pool_id</span></code> (int) - destination image pool id</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">dest_pool_namespace</span></code> (str) - destination image pool namespace</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">dest_image_name</span></code> (str) - destination image name</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">dest_image_id</span></code> (str) - destination image id</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">state</span></code> (int) - current migration state</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">state_description</span></code> (str) - migration state description</p></li>
</ul>
</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageNotFound</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_image_info_list">
<code class="sig-name descname"><span class="pre">mirror_image_info_list</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mode_filter</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_image_info_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterate over the mirror image instance ids of a pool.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p></li>
<li><p><strong>mode_filter</strong> – list images in this image mirror mode</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">MirrorImageInfoIterator</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_image_instance_id_list">
<code class="sig-name descname"><span class="pre">mirror_image_instance_id_list</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_image_instance_id_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterate over the mirror image instance ids of a pool.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">MirrorImageInstanceIdIterator</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_image_status_list">
<code class="sig-name descname"><span class="pre">mirror_image_status_list</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_image_status_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterate over the mirror image statuses of a pool.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">MirrorImageStatusIterator</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_image_status_summary">
<code class="sig-name descname"><span class="pre">mirror_image_status_summary</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_image_status_summary" title="Permalink to this definition">¶</a></dt>
<dd><p>Get mirror image status summary of a pool.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>list - a list of (state, count) tuples</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_mode_get">
<code class="sig-name descname"><span class="pre">mirror_mode_get</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_mode_get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get pool mirror mode.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>int - pool mirror mode</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_mode_set">
<code class="sig-name descname"><span class="pre">mirror_mode_set</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mirror_mode</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_mode_set" title="Permalink to this definition">¶</a></dt>
<dd><p>Set pool mirror mode.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is written</p></li>
<li><p><strong>mirror_mode</strong> (<em>int</em>) – mirror mode to set</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_peer_add">
<code class="sig-name descname"><span class="pre">mirror_peer_add</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">site_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">client_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">direction</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">RBD_MIRROR_PEER_DIRECTION_RX_TX</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_peer_add" title="Permalink to this definition">¶</a></dt>
<dd><p>Add mirror peer.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is used</p></li>
<li><p><strong>site_name</strong> (<em>str</em>) – mirror peer site name</p></li>
<li><p><strong>client_name</strong> (<em>str</em>) – mirror peer client name</p></li>
<li><p><strong>direction</strong> (<em>int</em>) – the direction of the mirroring</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>str - peer uuid</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_peer_bootstrap_create">
<code class="sig-name descname"><span class="pre">mirror_peer_bootstrap_create</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_peer_bootstrap_create" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a new RBD mirroring bootstrap token for an
external cluster.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is written</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>str - bootstrap token</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_peer_bootstrap_import">
<code class="sig-name descname"><span class="pre">mirror_peer_bootstrap_import</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">direction</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">token</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_peer_bootstrap_import" title="Permalink to this definition">¶</a></dt>
<dd><p>Import a bootstrap token from an external cluster to
auto-configure the mirror peer.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is written</p></li>
<li><p><strong>direction</strong> (<em>int</em>) – mirror peer direction</p></li>
<li><p><strong>token</strong> (<em>str</em>) – bootstrap token</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_peer_get_attributes">
<code class="sig-name descname"><span class="pre">mirror_peer_get_attributes</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">uuid</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_peer_get_attributes" title="Permalink to this definition">¶</a></dt>
<dd><p>Get optional mirror peer attributes</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is written</p></li>
<li><p><strong>uuid</strong> (<em>str</em>) – uuid of the mirror peer</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>dict - contains the following keys:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">mon_host</span></code> (str) - monitor addresses</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">key</span></code> (str) - CephX key</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_peer_list">
<code class="sig-name descname"><span class="pre">mirror_peer_list</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_peer_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterate over the peers of a pool.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">MirrorPeerIterator</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_peer_remove">
<code class="sig-name descname"><span class="pre">mirror_peer_remove</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">uuid</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_peer_remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove mirror peer.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is used</p></li>
<li><p><strong>uuid</strong> (<em>str</em>) – peer uuid</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_peer_set_attributes">
<code class="sig-name descname"><span class="pre">mirror_peer_set_attributes</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">uuid</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">attributes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_peer_set_attributes" title="Permalink to this definition">¶</a></dt>
<dd><p>Set optional mirror peer attributes</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is written</p></li>
<li><p><strong>uuid</strong> (<em>str</em>) – uuid of the mirror peer</p></li>
<li><p><strong>attributes</strong> (<em>dict</em>) – ‘mon_host’ and ‘key’ attributes</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_peer_set_client">
<code class="sig-name descname"><span class="pre">mirror_peer_set_client</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">uuid</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">client_name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_peer_set_client" title="Permalink to this definition">¶</a></dt>
<dd><p>Set mirror peer client name</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is written</p></li>
<li><p><strong>uuid</strong> (<em>str</em>) – uuid of the mirror peer</p></li>
<li><p><strong>client_name</strong> (<em>str</em>) – client name of the mirror peer to set</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_peer_set_cluster">
<code class="sig-name descname"><span class="pre">mirror_peer_set_cluster</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">uuid</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cluster_name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_peer_set_cluster" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_peer_set_name">
<code class="sig-name descname"><span class="pre">mirror_peer_set_name</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">uuid</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">site_name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_peer_set_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Set mirror peer site name</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is written</p></li>
<li><p><strong>uuid</strong> (<em>str</em>) – uuid of the mirror peer</p></li>
<li><p><strong>site_name</strong> (<em>str</em>) – site name of the mirror peer to set</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_site_name_get">
<code class="sig-name descname"><span class="pre">mirror_site_name_get</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rados</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_site_name_get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the local cluster’s friendly site name</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>rados</strong> – cluster connection</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>str - local site name</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_site_name_set">
<code class="sig-name descname"><span class="pre">mirror_site_name_set</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rados</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">site_name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_site_name_set" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the local cluster’s friendly site name</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>rados</strong> – cluster connection</p></li>
<li><p><strong>site_name</strong> – friendly site name</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.mirror_uuid_get">
<code class="sig-name descname"><span class="pre">mirror_uuid_get</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.mirror_uuid_get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get pool mirror uuid</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>ste - pool mirror uuid</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.namespace_create">
<code class="sig-name descname"><span class="pre">namespace_create</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.namespace_create" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an RBD namespace within a pool</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool</p></li>
<li><p><strong>name</strong> (<em>str</em>) – namespace name</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.namespace_exists">
<code class="sig-name descname"><span class="pre">namespace_exists</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.namespace_exists" title="Permalink to this definition">¶</a></dt>
<dd><p>Verifies if a namespace exists within a pool</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool</p></li>
<li><p><strong>name</strong> (<em>str</em>) – namespace name</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>bool - true if namespace exists</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.namespace_list">
<code class="sig-name descname"><span class="pre">namespace_list</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.namespace_list" title="Permalink to this definition">¶</a></dt>
<dd><p>List all namespaces within a pool</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>list - collection of namespace names</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.namespace_remove">
<code class="sig-name descname"><span class="pre">namespace_remove</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.namespace_remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove an RBD namespace from a pool</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool</p></li>
<li><p><strong>name</strong> (<em>str</em>) – namespace name</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.pool_init">
<code class="sig-name descname"><span class="pre">pool_init</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">force</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.pool_init" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize an RBD pool
:param ioctx: determines which RADOS pool
:type ioctx: <code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>
:param force: force init
:type force: bool</p>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.pool_metadata_get">
<code class="sig-name descname"><span class="pre">pool_metadata_get</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.pool_metadata_get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get pool metadata for the given key.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p></li>
<li><p><strong>key</strong> (<em>str</em>) – metadata key</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>str - metadata value</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.pool_metadata_list">
<code class="sig-name descname"><span class="pre">pool_metadata_list</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.pool_metadata_list" title="Permalink to this definition">¶</a></dt>
<dd><p>List pool metadata.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">PoolMetadataIterator</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.pool_metadata_remove">
<code class="sig-name descname"><span class="pre">pool_metadata_remove</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.pool_metadata_remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove pool metadata for the given key.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p></li>
<li><p><strong>key</strong> (<em>str</em>) – metadata key</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>str - metadata value</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.pool_metadata_set">
<code class="sig-name descname"><span class="pre">pool_metadata_set</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.pool_metadata_set" title="Permalink to this definition">¶</a></dt>
<dd><p>Set pool metadata for the given key.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool is read</p></li>
<li><p><strong>key</strong> (<em>str</em>) – metadata key</p></li>
<li><p><strong>value</strong> (<em>str</em>) – metadata value</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.pool_stats_get">
<code class="sig-name descname"><span class="pre">pool_stats_get</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.pool_stats_get" title="Permalink to this definition">¶</a></dt>
<dd><p>Return RBD pool stats</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>dict - contains the following keys:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">image_count</span></code> (int) - image count</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">image_provisioned_bytes</span></code> (int) - image total HEAD provisioned bytes</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">image_max_provisioned_bytes</span></code> (int) - image total max provisioned bytes</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">image_snap_count</span></code> (int) - image snap count</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">trash_count</span></code> (int) - trash image count</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">trash_provisioned_bytes</span></code> (int) - trash total HEAD provisioned bytes</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">trash_max_provisioned_bytes</span></code> (int) - trash total max provisioned bytes</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">trash_snap_count</span></code> (int) - trash snap count</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.remove">
<code class="sig-name descname"><span class="pre">remove</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">on_progress</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete an RBD image. This may take a long time, since it does
not return until every object that comprises the image has
been deleted. Note that all snapshots must be deleted before
the image can be removed. If there are snapshots left,
<code class="xref py py-class docutils literal notranslate"><span class="pre">ImageHasSnapshots</span></code> is raised. If the image is still
open, or the watch from a crashed client has not expired,
<code class="xref py py-class docutils literal notranslate"><span class="pre">ImageBusy</span></code> is raised.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>name</strong> (<em>str</em>) – the name of the image to remove</p></li>
<li><p><strong>on_progress</strong> (<em>callback function</em>) – optional progress callback function</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageNotFound</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">ImageBusy</span></code>,
<code class="xref py py-class docutils literal notranslate"><span class="pre">ImageHasSnapshots</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.rename">
<code class="sig-name descname"><span class="pre">rename</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">src</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.rename" title="Permalink to this definition">¶</a></dt>
<dd><p>Rename an RBD image.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>src</strong> (<em>str</em>) – the current name of the image</p></li>
<li><p><strong>dest</strong> (<em>str</em>) – the new name of the image</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageNotFound</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">ImageExists</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.trash_get">
<code class="sig-name descname"><span class="pre">trash_get</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.trash_get" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieve RBD image info from trash.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>image_id</strong> (<em>str</em>) – the id of the image to restore</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>dict - contains the following keys:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">id</span></code> (str) - image id</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">name</span></code> (str) - image name</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">source</span></code> (str) - source of deletion</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">deletion_time</span></code> (datetime) - time of deletion</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">deferment_end_time</span></code> (datetime) - time that an image is allowed
to be removed from trash</p></li>
</ul>
</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageNotFound</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.trash_list">
<code class="sig-name descname"><span class="pre">trash_list</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.trash_list" title="Permalink to this definition">¶</a></dt>
<dd><p>List all entries from trash.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">TrashIterator</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.trash_move">
<code class="sig-name descname"><span class="pre">trash_move</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">delay</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.trash_move" title="Permalink to this definition">¶</a></dt>
<dd><p>Move an RBD image to the trash.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>name</strong> (<em>str</em>) – the name of the image to remove</p></li>
<li><p><strong>delay</strong> (<em>int</em>) – time delay in seconds before the image can be deleted
from trash</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageNotFound</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.trash_purge">
<code class="sig-name descname"><span class="pre">trash_purge</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">expire_ts</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">threshold</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.trash_purge" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete RBD images from trash in bulk.</p>
<p>By default it removes images with deferment end time less than now.</p>
<p>The timestamp is configurable, e.g. delete images that have expired a
week ago.</p>
<p>If the threshold is used it deletes images until X% pool usage is met.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>expire_ts</strong> (<em>datetime</em>) – timestamp for images to be considered as expired (UTC)</p></li>
<li><p><strong>threshold</strong> (<em>float</em>) – percentage of pool usage to be met (0 to 1)</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.trash_remove">
<code class="sig-name descname"><span class="pre">trash_remove</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">force</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">on_progress</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.trash_remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete an RBD image from trash. If image deferment time has not
expired <code class="xref py py-class docutils literal notranslate"><span class="pre">PermissionError</span></code> is raised.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>image_id</strong> (<em>str</em>) – the id of the image to remove</p></li>
<li><p><strong>force</strong> (<em>bool</em>) – force remove even if deferment time has not expired</p></li>
<li><p><strong>on_progress</strong> (<em>callback function</em>) – optional progress callback function</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageNotFound</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">PermissionError</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.trash_restore">
<code class="sig-name descname"><span class="pre">trash_restore</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ioctx</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.trash_restore" title="Permalink to this definition">¶</a></dt>
<dd><p>Restore an RBD image from trash.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ioctx</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">rados.Ioctx</span></code>) – determines which RADOS pool the image is in</p></li>
<li><p><strong>image_id</strong> (<em>str</em>) – the id of the image to restore</p></li>
<li><p><strong>name</strong> (<em>str</em>) – the new name of the restored image</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ImageNotFound</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="rbd.RBD.version">
<code class="sig-name descname"><span class="pre">version</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.RBD.version" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the version number of the <code class="docutils literal notranslate"><span class="pre">librbd</span></code> C library.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>a tuple of <code class="docutils literal notranslate"><span class="pre">(major,</span> <span class="pre">minor,</span> <span class="pre">extra)</span></code> components of the
librbd version</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="rbd.SnapIterator">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">rbd.</span></code><code class="sig-name descname"><span class="pre">SnapIterator</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="pre">Image</span> <span class="pre">image</span></em><span class="sig-paren">)</span><a class="headerlink" href="#rbd.SnapIterator" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterator over snapshot info for an image.</p>
<p>Yields a dictionary containing information about a snapshot.</p>
<p>Keys are:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">id</span></code> (int) - numeric identifier of the snapshot</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">size</span></code> (int) - size of the image at the time of snapshot (in bytes)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">name</span></code> (str) - name of the snapshot</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">namespace</span></code> (int) - enum for snap namespace</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">group</span></code> (dict) - optional for group namespace snapshots</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">trash</span></code> (dict) - optional for trash namespace snapshots</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">mirror</span></code> (dict) - optional for mirror namespace snapshots</p></li>
</ul>
</dd></dl>

</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../../../radosgw/" class="btn btn-neutral float-right" title="Ceph 对象网关" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../" class="btn btn-neutral float-left" title="Ceph 块设备 API" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>